package exa.administrator.ksoap2test01;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void click01(View view){
        new Thread(){
            @Override
            public void run(){
                String url = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl";
                String targetNamespace = "http://WebXml.com.cn";
                String action = "getRegionProvince";
                HttpTransportSE tran = new HttpTransportSE(url);
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

                SoapObject body = new SoapObject(targetNamespace, action);
                //body.addProperty("","");
                envelope.setOutputSoapObject(body);

                try {
                    tran.call(targetNamespace + "/" + action, envelope);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                SoapObject obj = (SoapObject) envelope.bodyIn;
                for (int i = 0; i < obj.getPropertyCount(); i++){
                    Log.i("zw",obj.getProperty(i) + "...");
                }
            }
        }.start();
    }
}
